<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>自动化办公工具集</title>
    <!-- 引入Tailwind CSS -->
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <!-- 引入Font Awesome -->
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <!-- 引入Google Fonts -->
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <style>
        :root {
            --primary-color: #4F46E5;
            --primary-hover: #4338CA;
            --secondary-color: #10B981;
            --secondary-hover: #059669;
            --accent-color: #F59E0B;
            --accent-hover: #D97706;
            --text-primary: #1F2937;
            --text-secondary: #4B5563;
            --bg-primary: #FFFFFF;
            --bg-secondary: #F9FAFB;
            --card-bg: #FFFFFF;
            --card-border: #E5E7EB;
            --card-shadow: rgba(0, 0, 0, 0.05);
        }
        
        .dark {
            --primary-color: #6366F1;
            --primary-hover: #4F46E5;
            --secondary-color: #10B981;
            --secondary-hover: #059669;
            --accent-color: #F59E0B;
            --accent-hover: #D97706;
            --text-primary: #F9FAFB;
            --text-secondary: #D1D5DB;
            --bg-primary: #111827;
            --bg-secondary: #1F2937;
            --card-bg: #1F2937;
            --card-border: #374151;
            --card-shadow: rgba(0, 0, 0, 0.3);
        }
        
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            color: var(--text-primary);
            background-color: var(--bg-primary);
            transition: background-color 0.3s, color 0.3s;
        }
        
        h1, h2, h3, h4, h5, h6 {
            font-family: 'Noto Serif SC', serif;
            font-weight: 600;
        }
        
        .feature-card {
            background-color: var(--card-bg);
            border: 1px solid var(--card-border);
            border-radius: 0.75rem;
            padding: 1.5rem;
            margin-bottom: 1.5rem;
            transition: all 0.3s ease;
            height: 100%;
            display: flex;
            flex-direction: column;
        }
        
        .feature-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 15px var(--card-shadow);
        }
        
        .feature-card h4 {
            display: flex;
            align-items: center;
            margin-bottom: 1rem;
            font-size: 1.25rem;
            color: var(--primary-color);
        }
        
        .feature-card h4 i {
            margin-right: 0.75rem;
            font-size: 1.5rem;
        }
        
        .feature-card form {
            flex-grow: 1;
            display: flex;
            flex-direction: column;
        }
        
        .feature-card form button {
            margin-top: auto;
            align-self: flex-start;
        }
        
        .form-input {
            width: 100%;
            padding: 0.5rem 0.75rem;
            border: 1px solid var(--card-border);
            border-radius: 0.375rem;
            background-color: var(--bg-primary);
            color: var(--text-primary);
            transition: border-color 0.2s;
        }
        
        .form-input:focus {
            outline: none;
            border-color: var(--primary-color);
            box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
        }
        
        .form-input::placeholder {
            color: var(--text-secondary);
            opacity: 0.7;
        }
        
        .btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            padding: 0.5rem 1rem;
            font-weight: 500;
            border-radius: 0.375rem;
            transition: all 0.2s;
            cursor: pointer;
        }
        
        .btn-primary {
            background-color: var(--primary-color);
            color: white;
        }
        
        .btn-primary:hover {
            background-color: var(--primary-hover);
        }
        
        .btn-secondary {
            background-color: var(--secondary-color);
            color: white;
        }
        
        .btn-secondary:hover {
            background-color: var(--secondary-hover);
        }
        
        .btn-accent {
            background-color: var(--accent-color);
            color: white;
        }
        
        .btn-accent:hover {
            background-color: var(--accent-hover);
        }
        
        .btn i {
            margin-right: 0.5rem;
        }
        
        .section-title {
            position: relative;
            padding-bottom: 0.75rem;
            margin-bottom: 2rem;
            font-weight: 700;
            color: var(--primary-color);
        }
        
        .section-title::after {
            content: '';
            position: absolute;
            bottom: 0;
            left: 0;
            width: 50px;
            height: 3px;
            background-color: var(--primary-color);
            border-radius: 3px;
        }
        
        .theme-switch {
            position: fixed;
            top: 1rem;
            right: 1rem;
            z-index: 100;
            width: 40px;
            height: 40px;
            border-radius: 50%;
            background-color: var(--card-bg);
            border: 1px solid var(--card-border);
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            box-shadow: 0 2px 5px var(--card-shadow);
            transition: all 0.3s;
        }
        
        .theme-switch:hover {
            transform: scale(1.1);
        }
        
        .theme-switch i {
            font-size: 1.25rem;
            color: var(--text-primary);
        }
        
        @media (max-width: 768px) {
            .container {
                padding-left: 1rem;
                padding-right: 1rem;
            }
        }
        
        /* 自定义复选框样式 */
        .custom-checkbox {
            display: flex;
            align-items: center;
            cursor: pointer;
            user-select: none;
        }
        
        .custom-checkbox input {
            position: absolute;
            opacity: 0;
            cursor: pointer;
            height: 0;
            width: 0;
        }
        
        .checkmark {
            position: relative;
            height: 20px;
            width: 20px;
            background-color: var(--bg-primary);
            border: 2px solid var(--primary-color);
            border-radius: 4px;
            margin-right: 0.5rem;
        }
        
        .custom-checkbox:hover input ~ .checkmark {
            background-color: var(--bg-secondary);
        }
        
        .custom-checkbox input:checked ~ .checkmark {
            background-color: var(--primary-color);
        }
        
        .checkmark:after {
            content: "";
            position: absolute;
            display: none;
        }
        
        .custom-checkbox input:checked ~ .checkmark:after {
            display: block;
        }
        
        .custom-checkbox .checkmark:after {
            left: 6px;
            top: 2px;
            width: 5px;
            height: 10px;
            border: solid white;
            border-width: 0 2px 2px 0;
            transform: rotate(45deg);
        }
        
        /* 工具卡片分类颜色 */
        .file-tool {
            border-top: 3px solid #4F46E5;
        }
        
        .image-tool {
            border-top: 3px solid #10B981;
        }
        
        .excel-tool {
            border-top: 3px solid #F59E0B;
        }
        
        .pdf-tool {
            border-top: 3px solid #EF4444;
        }
        
        /* 页面过渡动画 */
        .fade-in {
            animation: fadeIn 0.5s ease-in-out;
        }
        
        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(10px); }
            to { opacity: 1; transform: translateY(0); }
        }
        
        /* 工具提示 */
        .tooltip {
            position: relative;
            display: inline-block;
        }
        
        .tooltip .tooltip-text {
            visibility: hidden;
            width: 200px;
            background-color: var(--card-bg);
            color: var(--text-primary);
            text-align: center;
            border-radius: 6px;
            padding: 5px;
            position: absolute;
            z-index: 1;
            bottom: 125%;
            left: 50%;
            margin-left: -100px;
            opacity: 0;
            transition: opacity 0.3s;
            box-shadow: 0 2px 8px var(--card-shadow);
            border: 1px solid var(--card-border);
            font-size: 0.875rem;
        }
        
        .tooltip:hover .tooltip-text {
            visibility: visible;
            opacity: 1;
        }
    </style>
</head>
<body class="fade-in">
    <!-- 主题切换按钮 -->
    <div class="theme-switch" id="themeSwitch">
        <i class="fas fa-moon" id="themeIcon"></i>
    </div>
    
    <div class="container mx-auto py-8 px-4">
        <header class="text-center mb-12">
            <h1 class="text-4xl font-bold mb-4">自动化办公工具集</h1>
            <p class="text-lg text-gray-600 dark:text-gray-300 max-w-2xl mx-auto">提升工作效率的一站式办公自动化解决方案，让繁琐的工作变得简单高效</p>
        </header>
        
        <!-- 文件处理模块 -->
        <section class="mb-16 fade-in" style="animation-delay: 0.1s;">
            <h2 class="section-title text-2xl"><i class="fas fa-folder-open mr-2"></i>文件处理工具</h2>
            <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
                <div class="feature-card file-tool">
                    <h4><i class="fas fa-chart-bar"></i>文件统计</h4>
                    <p class="text-sm text-gray-600 dark:text-gray-300 mb-4">快速分析文件的基本信息，包括大小、行数、字符数等统计数据</p>
                    <form action="/file/stats" method="post">
                        <div class="mb-4">
                            <label for="stats-file" class="block text-sm font-medium mb-1">文件路径</label>
                            <input type="text" class="form-input" id="stats-file" name="file_path" placeholder="请输入文件路径" required>
                        </div>
                        <button type="submit" class="btn btn-primary"><i class="fas fa-calculator"></i>统计信息</button>
                    </form>
                </div>
                
                <div class="feature-card file-tool">
                    <h4><i class="fas fa-sort-amount-down"></i>文件分类</h4>
                    <p class="text-sm text-gray-600 dark:text-gray-300 mb-4">自动整理文件夹中的文件，按类型分类存放，让文件管理更有条理</p>
                    <form action="/file/organize" method="post">
                        <div class="mb-4">
                            <label for="organize-dir" class="block text-sm font-medium mb-1">目录路径</label>
                            <input type="text" class="form-input" id="organize-dir" name="source_dir" placeholder="请输入目录路径" required>
                        </div>
                        <button type="submit" class="btn btn-primary"><i class="fas fa-magic"></i>开始分类</button>
                    </form>
                </div>
                
                <div class="feature-card file-tool">
                    <h4><i class="fas fa-font"></i>批量重命名</h4>
                    <p class="text-sm text-gray-600 dark:text-gray-300 mb-4">为多个文件批量添加前缀或后缀，提高文件命名的一致性和规范性</p>
                    <form action="/file/batch-rename" method="post">
                        <div class="mb-4">
                            <label for="rename-dir" class="block text-sm font-medium mb-1">目录路径</label>
                            <input type="text" class="form-input" id="rename-dir" name="dir_path" placeholder="请输入目录路径" required>
                        </div>
                        <div class="mb-4">
                            <label for="prefix" class="block text-sm font-medium mb-1">前缀</label>
                            <input type="text" class="form-input" id="prefix" name="prefix" placeholder="可选">
                        </div>
                        <div class="mb-4">
                            <label for="suffix" class="block text-sm font-medium mb-1">后缀</label>
                            <input type="text" class="form-input" id="suffix" name="suffix" placeholder="可选">
                        </div>
                        <button type="submit" class="btn btn-primary"><i class="fas fa-tag"></i>开始重命名</button>
                    </form>
                </div>
                
                <div class="feature-card file-tool">
                    <h4><i class="fas fa-copy"></i>查找重复文件</h4>
                    <p class="text-sm text-gray-600 dark:text-gray-300 mb-4">扫描目录中的重复文件，帮助清理磁盘空间，提高存储效率</p>
                    <form action="/file/find-duplicates" method="post">
                        <div class="mb-4">
                            <label for="duplicate-dir" class="block text-sm font-medium mb-1">目录路径</label>
                            <input type="text" class="form-input" id="duplicate-dir" name="dir_path" placeholder="请输入目录路径" required>
                        </div>
                        <button type="submit" class="btn btn-primary"><i class="fas fa-search"></i>查找重复</button>
                    </form>
                </div>
                
                <div class="feature-card file-tool">
                    <h4><i class="fas fa-search"></i>文件搜索</h4>
                    <p class="text-sm text-gray-600 dark:text-gray-300 mb-4">根据文件名模式快速查找文件，支持模糊搜索和正则表达式</p>
                    <form action="/file/search" method="post">
                        <div class="mb-4">
                            <label for="search-dir" class="block text-sm font-medium mb-1">目录路径</label>
                            <input type="text" class="form-input" id="search-dir" name="dir_path" placeholder="请输入目录路径" required>
                        </div>
                        <div class="mb-4">
                            <label for="pattern" class="block text-sm font-medium mb-1">搜索模式</label>
                            <input type="text" class="form-input" id="pattern" name="pattern" placeholder="支持模糊搜索和正则表达式" required>
                        </div>
                        <button type="submit" class="btn btn-primary"><i class="fas fa-search"></i>开始搜索</button>
                    </form>
                </div>
            </div>
        </section>

        <!-- 图片处理模块 -->
        <section class="mb-16 fade-in" style="animation-delay: 0.2s;">
            <h2 class="section-title text-2xl"><i class="fas fa-image mr-2"></i>图片处理工具</h2>
            <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
                <div class="feature-card image-tool">
                    <h4><i class="fas fa-file-alt"></i>图片文字提取</h4>
                    <p class="text-sm text-gray-600 dark:text-gray-300 mb-4">从图片中提取文字内容，支持普通OCR和AI增强识别</p>
                    <form action="/image/extract-text" method="post">
                        <div class="mb-4">
                            <label for="image-file" class="block text-sm font-medium mb-1">图片路径</label>
                            <input type="text" class="form-input" id="image-file" name="image_path" placeholder="请输入图片路径" required>
                        </div>
                        <div class="mb-4">
                            <label class="custom-checkbox">
                                <input type="checkbox" id="use-ai" name="use_ai">
                                <span class="checkmark"></span>
                                使用AI识别（更准确）
                            </label>
                            <div class="tooltip ml-2">
                                <i class="fas fa-info-circle text-gray-500"></i>
                                <span class="tooltip-text">AI识别能够处理更复杂的图像，提高识别准确率</span>
                            </div>
                        </div>
                        <button type="submit" class="btn btn-secondary"><i class="fas fa-eye"></i>提取文字</button>
                    </form>
                </div>
            </div>
        </section>

        <!-- Excel处理模块 -->
        <section class="mb-16 fade-in" style="animation-delay: 0.3s;">
            <h2 class="section-title text-2xl"><i class="fas fa-table mr-2"></i>Excel工具</h2>
            <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
                <div class="feature-card excel-tool">
                    <h4><i class="fas fa-broom"></i>数据清洗</h4>
                    <p class="text-sm text-gray-600 dark:text-gray-300 mb-4">自动清理Excel数据中的异常值、重复项和格式问题</p>
                    <form action="/excel/clean" method="post">
                        <div class="mb-4">
                            <label for="clean-excel" class="block text-sm font-medium mb-1">Excel文件路径</label>
                            <input type="text" class="form-input" id="clean-excel" name="file_path" placeholder="请输入Excel文件路径" required>
                        </div>
                        <button type="submit" class="btn btn-accent"><i class="fas fa-broom"></i>开始清洗</button>
                    </form>
                </div>
                
                <div class="feature-card excel-tool">
                    <h4><i class="fas fa-chart-pie"></i>数据汇总分析</h4>
                    <p class="text-sm text-gray-600 dark:text-gray-300 mb-4">对Excel数据进行汇总统计和分析，生成数据报表</p>
                    <form action="/excel/summary" method="post">
                        <div class="mb-4">
                            <label for="summary-excel" class="block text-sm font-medium mb-1">Excel文件路径</label>
                            <input type="text" class="form-input" id="summary-excel" name="file_path" placeholder="请输入Excel文件路径" required>
                        </div>
                        <button type="submit" class="btn btn-accent"><i class="fas fa-chart-line"></i>开始汇总</button>
                    </form>
                </div>
            </div>
        </section>

        <!-- PDF处理模块 -->
        <section class="mb-16 fade-in" style="animation-delay: 0.4s;">
            <h2 class="section-title text-2xl"><i class="fas fa-file-pdf mr-2"></i>PDF工具</h2>
            <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
                <div class="feature-card pdf-tool">
                    <h4><i class="fas fa-file-alt"></i>文本提取</h4>
                    <p class="text-sm text-gray-600 dark:text-gray-300 mb-4">从PDF文档中提取文本内容，便于文本处理和分析</p>
                    <form action="/pdf/to-text" method="post">
                        <div class="mb-4">
                            <label for="text-pdf" class="block text-sm font-medium mb-1">PDF文件路径</label>
                            <input type="text" class="form-input" id="text-pdf" name="file_path" placeholder="请输入PDF文件路径" required>
                        </div>
                        <button type="submit" class="btn btn-primary" style="background-color: #EF4444; background-color: #DC2626;"><i class="fas fa-file-alt"></i>提取文本</button>
                    </form>
                </div>
                
                <div class="feature-card pdf-tool">
                    <h4><i class="fas fa-images"></i>转换为图片</h4>
                    <p class="text-sm text-gray-600 dark:text-gray-300 mb-4">将PDF文档转换为图片格式，支持多种图片格式选项</p>
                    <form action="/pdf/to-image" method="post">
                        <div class="mb-4">
                            <label for="image-pdf" class="block text-sm font-medium mb-1">PDF文件路径</label>
                            <input type="text" class="form-input" id="image-pdf" name="file_path" placeholder="请输入PDF文件路径" required>
                        </div>
                        <div class="mb-4">
                            <label class="custom-checkbox">
                                <input type="checkbox" id="use-imagemagick" name="use_imagemagick">
                                <span class="checkmark"></span>
                                使用ImageMagick（更多格式选项）
                            </label>
                            <div class="tooltip ml-2">
                                <i class="fas fa-info-circle text-gray-500"></i>
                                <span class="tooltip-text">ImageMagick提供更多图片格式和处理选项</span>
                            </div>
                        </div>
                        <button type="submit" class="btn btn-primary" style="background-color: #EF4444; background-color: #DC2626;"><i class="fas fa-images"></i>转换图片</button>
                    </form>
                </div>
                
                <div class="feature-card pdf-tool">
                    <h4><i class="fas fa-receipt"></i>发票数据提取</h4>
                    <p class="text-sm text-gray-600 dark:text-gray-300 mb-4">从PDF发票中提取关键数据，如金额、日期、税号等信息</p>
                    <form action="/pdf/extract-invoice" method="post">
                        <div class="mb-4">
                            <label for="invoice-pdf" class="block text-sm font-medium mb-1">PDF文件路径</label>
                            <input type="text" class="form-input" id="invoice-pdf" name="file_path" placeholder="请输入PDF文件路径" required>
                        </div>
                        <button type="submit" class="btn btn-primary" style="background-color: #EF4444; hover:background-color: #DC2626;"><i class="fas fa-file-invoice-dollar"></i>提取数据</button>
                    </form>
                </div>
                
                <div class="feature-card pdf-tool">
                    <h4><i class="fas fa-file-export"></i>Office转PDF</h4>
                    <p class="text-sm text-gray-600 dark:text-gray-300 mb-4">将Word、Excel、PowerPoint等Office文档转换为PDF格式</p>
                    <form action="/pdf/office-to-pdf" method="post">
                        <div class="mb-4">
                            <label for="office-file" class="block text-sm font-medium mb-1">Office文件路径</label>
                            <input type="text" class="form-input" id="office-file" name="file_path" placeholder="请输入Office文件路径" required>
                        </div>
                        <button type="submit" class="btn btn-primary" style="background-color: #EF4444; background-color: #DC2626;"><i class="fas fa-file-pdf"></i>转换PDF</button>
                    </form>
                </div>
            </div>
        </section>
        
        <!-- 页脚 -->
        <footer class="text-center text-gray-500 dark:text-gray-400 mt-16 pt-8 border-t border-gray-200 dark:border-gray-700">
            <p>© 2023 自动化办公工具集 | 提升工作效率的得力助手</p>
            <div class="mt-4 flex justify-center space-x-4">
                <a href="#" class="text-gray-500 hover:text-primary-color transition-colors">
                    <i class="fab fa-github"></i>
                </a>
                <a href="#" class="text-gray-500 hover:text-primary-color transition-colors">
                    <i class="fas fa-book"></i>
                </a>
                <a href="#" class="text-gray-500 hover:text-primary-color transition-colors">
                    <i class="fas fa-question-circle"></i>
                </a>
            </div>
            <div class="mt-6">
                <h3 class="text-lg font-medium mb-2">延伸阅读</h3>
                <ul class="text-sm">
                    <li class="mb-1"><a href="#" class="hover:text-primary-color transition-colors">《Python自动化办公实战》- 全面介绍Python办公自动化技术</a></li>
                    <li class="mb-1"><a href="#" class="hover:text-primary-color transition-colors">《Excel数据处理与分析》- 深入Excel数据处理技巧</a></li>
                    <li class="mb-1"><a href="#" class="hover:text-primary-color transition-colors">《PDF处理技术指南》- PDF文档处理的专业指南</a></li>
                    <li class="mb-1"><a href="#" class="hover:text-primary-color transition-colors">《文件管理与组织系统》- 高效文件管理方法论</a></li>
                </ul>
            </div>
        </footer>
    </div>
    <script>
        // 主题切换功能
        const themeSwitch = document.getElementById('themeSwitch');
        const themeIcon = document.getElementById('themeIcon');
        const htmlElement = document.documentElement;
        
        // 从本地存储中获取主题设置
        const isDarkMode = localStorage.getItem('darkMode') === 'true';
        if (isDarkMode) {
            htmlElement.classList.add('dark');
            themeIcon.classList.remove('fa-moon');
            themeIcon.classList.add('fa-sun');
        }
        
        // 切换主题
        themeSwitch.addEventListener('click', () => {
            htmlElement.classList.toggle('dark');
            const isDark = htmlElement.classList.contains('dark');
            
            // 切换图标
            if (isDark) {
                themeIcon.classList.remove('fa-moon');
                themeIcon.classList.add('fa-sun');
            } else {
                themeIcon.classList.remove('fa-sun');
                themeIcon.classList.add('fa-moon');
            }
            
            // 保存主题设置到本地存储
            localStorage.setItem('darkMode', isDark);
        });
    </script>
</body>
</html>